package cn.edu.huanghuai.newsofhuanghuai.sevice.Impl;

import cn.edu.huanghuai.newsofhuanghuai.dao.UserDao;
import cn.edu.huanghuai.newsofhuanghuai.pojo.User;
import cn.edu.huanghuai.newsofhuanghuai.sevice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * user:liguo
 * date:2025/6/11
 * suaige
 */
@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserDao userDao;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }
    @Override
    public User getUser(int id){ return userDao.findUserById(id);}
    @Override
    public int updateUser(User user) {return userDao.updateUser(user);}
    @Override
    public int deleteUser(int id) {return userDao.deleteUser(id);}

    @Override
    public List<User> queryAllUser() {
        return userDao.queryAllUser();
    }

    @Override
    public int banUser(int id) {
        return userDao.banUser(id);
    }

    @Override
    public int releaseUser(int id) {
        return userDao.releaseUser(id);
    }


    /**
     * 根据用户姓名来查询用户对象
     * @param username
     * @return
     */
    @Override
    public User queryUserByName(String username) {
        return userDao.findUserByName(username);
    }

    /**
     * 注册用户 增加新的用户
     * @param user
     * @return
     */
    @Override
    public int registerUser(User user) {
        return userDao.registerUser(user);
    }


}
